/*
 * Copyright 2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mx.ymate.security.base.model;

import net.ymate.platform.core.beans.annotation.PropertyState;
import net.ymate.platform.core.persistence.annotation.Comment;
import net.ymate.platform.core.persistence.annotation.Default;
import net.ymate.platform.core.persistence.annotation.Entity;
import net.ymate.platform.core.persistence.annotation.Id;
import net.ymate.platform.core.persistence.annotation.Property;
import net.ymate.platform.persistence.jdbc.query.AbstractFieldConditionBuilder;
import net.ymate.platform.persistence.jdbc.query.FieldCondition;
import net.ymate.platform.persistence.jdbc.query.Query;
import net.ymate.platform.persistence.jdbc.support.BaseEntity;
import net.ymate.platform.core.persistence.IShardingable;
import net.ymate.platform.persistence.jdbc.IDatabase;
import net.ymate.platform.persistence.jdbc.IDatabaseConnectionHolder;

/**
 * SecurityMenu generated By EntityMojo on 2022/07/11 14:10:31
 *
 * @author YMP (https://www.ymate.net/)
 */
@Entity(SecurityMenu.TABLE_NAME)
@Comment("菜单表")
public class SecurityMenu extends BaseEntity<SecurityMenu, java.lang.String> {

    private static final long serialVersionUID = 1L;

    @Id
    @Property(name = FIELDS.ID, nullable = false, length = 32)
    @Comment("id")
    @PropertyState(propertyName = FIELDS.ID)
    private java.lang.String id;

    
    @Property(name = FIELDS.RESOURCE_ID, nullable = false, length = 32)
    @Comment("资源id 默认和客户端一致")
    @PropertyState(propertyName = FIELDS.RESOURCE_ID)
    private java.lang.String resourceId;

    
    @Property(name = FIELDS.CLIENT, nullable = false, length = 100)
    @Default("default")
    @Comment("客户端")
    @PropertyState(propertyName = FIELDS.CLIENT)
    private java.lang.String client;

    
    @Property(name = FIELDS.TYPE, nullable = false, length = 5)
    @Default("0")
    @Comment("菜单类型;0默认 1公开 2拥有者可看")
    @PropertyState(propertyName = FIELDS.TYPE)
    private java.lang.Integer type;

    
    @Property(name = FIELDS.PARENT_ID, nullable = false, length = 32)
    @Comment("父id")
    @PropertyState(propertyName = FIELDS.PARENT_ID)
    private java.lang.String parentId;

    
    @Property(name = FIELDS.NAME, nullable = false, length = 100)
    @Comment("菜单名称")
    @PropertyState(propertyName = FIELDS.NAME)
    private java.lang.String name;

    
    @Property(name = FIELDS.ICON, length = 255)
    @Comment("图标")
    @PropertyState(propertyName = FIELDS.ICON)
    private java.lang.String icon;

    
    @Property(name = FIELDS.PATH, length = 255)
    @Comment("路径")
    @PropertyState(propertyName = FIELDS.PATH)
    private java.lang.String path;

    
    @Property(name = FIELDS.URL, length = 16383)
    @Comment("地址")
    @PropertyState(propertyName = FIELDS.URL)
    private java.lang.String url;

    
    @Property(name = FIELDS.SORT, nullable = false, length = 10)
    @Default("0")
    @Comment("排序")
    @PropertyState(propertyName = FIELDS.SORT)
    private java.lang.Integer sort;

    
    @Property(name = FIELDS.HIDE_STATUS, nullable = false, length = 5)
    @Default("0")
    @Comment("是否隐藏 0否 1是")
    @PropertyState(propertyName = FIELDS.HIDE_STATUS)
    private java.lang.Integer hideStatus;


    public SecurityMenu() {
    }

    public SecurityMenu(IDatabase dbOwner) {
        super(dbOwner);
    }

    public SecurityMenu(java.lang.String id, java.lang.String resourceId, java.lang.String client, java.lang.Integer type, java.lang.String parentId, java.lang.String name, java.lang.Integer sort, java.lang.Integer hideStatus) {
        this.id = id;
        this.resourceId = resourceId;
        this.client = client;
        this.type = type;
        this.parentId = parentId;
        this.name = name;
        this.sort = sort;
        this.hideStatus = hideStatus;
    }

        public SecurityMenu(IDatabase dbOwner, java.lang.String id, java.lang.String resourceId, java.lang.String client, java.lang.Integer type, java.lang.String parentId, java.lang.String name, java.lang.Integer sort, java.lang.Integer hideStatus) {
            super(dbOwner);
            this.id = id;
            this.resourceId = resourceId;
            this.client = client;
            this.type = type;
            this.parentId = parentId;
            this.name = name;
            this.sort = sort;
            this.hideStatus = hideStatus;
        }

    public SecurityMenu(java.lang.String id, java.lang.String resourceId, java.lang.String client, java.lang.Integer type, java.lang.String parentId, java.lang.String name, java.lang.String icon, java.lang.String path, java.lang.String url, java.lang.Integer sort, java.lang.Integer hideStatus) {
        this.id = id;
        this.resourceId = resourceId;
        this.client = client;
        this.type = type;
        this.parentId = parentId;
        this.name = name;
        this.icon = icon;
        this.path = path;
        this.url = url;
        this.sort = sort;
        this.hideStatus = hideStatus;
    }

    public SecurityMenu(IDatabase dbOwner, java.lang.String id, java.lang.String resourceId, java.lang.String client, java.lang.Integer type, java.lang.String parentId, java.lang.String name, java.lang.String icon, java.lang.String path, java.lang.String url, java.lang.Integer sort, java.lang.Integer hideStatus) {
        super(dbOwner);
        this.id = id;
        this.resourceId = resourceId;
        this.client = client;
        this.type = type;
        this.parentId = parentId;
        this.name = name;
        this.icon = icon;
        this.path = path;
        this.url = url;
        this.sort = sort;
        this.hideStatus = hideStatus;
    }

    @Override
    public java.lang.String getId() {
        return id;
    }

    @Override
    public void setId(java.lang.String id) {
        this.id = id;
    }

    public java.lang.String getResourceId() {
        return resourceId;
    }

    public void setResourceId(java.lang.String resourceId) {
        this.resourceId = resourceId;
    }

    public java.lang.String getClient() {
        return client;
    }

    public void setClient(java.lang.String client) {
        this.client = client;
    }

    public java.lang.Integer getType() {
        return type;
    }

    public void setType(java.lang.Integer type) {
        this.type = type;
    }

    public java.lang.String getParentId() {
        return parentId;
    }

    public void setParentId(java.lang.String parentId) {
        this.parentId = parentId;
    }

    public java.lang.String getName() {
        return name;
    }

    public void setName(java.lang.String name) {
        this.name = name;
    }

    public java.lang.String getIcon() {
        return icon;
    }

    public void setIcon(java.lang.String icon) {
        this.icon = icon;
    }

    public java.lang.String getPath() {
        return path;
    }

    public void setPath(java.lang.String path) {
        this.path = path;
    }

    public java.lang.String getUrl() {
        return url;
    }

    public void setUrl(java.lang.String url) {
        this.url = url;
    }

    public java.lang.Integer getSort() {
        return sort;
    }

    public void setSort(java.lang.Integer sort) {
        this.sort = sort;
    }

    public java.lang.Integer getHideStatus() {
        return hideStatus;
    }

    public void setHideStatus(java.lang.Integer hideStatus) {
        this.hideStatus = hideStatus;
    }


    public Builder bind() {
        return new Builder(this);
    }

    public static Builder builder() {
        return new Builder();
    }

        public static Builder builder(IDatabase dbOwner) {
            return new Builder(dbOwner);
        }

    public static class Builder {

        private final SecurityMenu targetEntity;

        public Builder() {
            targetEntity = new SecurityMenu();
        }

        public Builder(IDatabase dbOwner) {
            targetEntity = new SecurityMenu(dbOwner);
        }

        public Builder(SecurityMenu targetEntity) {
            this.targetEntity = targetEntity;
        }

        public SecurityMenu build() {
            return targetEntity;
        }

        public IDatabaseConnectionHolder connectionHolder() {
            return targetEntity.getConnectionHolder();
        }

        public Builder connectionHolder(IDatabaseConnectionHolder connectionHolder) {
            targetEntity.setConnectionHolder(connectionHolder);
            return this;
        }

        public IDatabase dbOwner() {
            return targetEntity.getDbOwner();
        }

        public Builder dbOwner(IDatabase dbOwner) {
            targetEntity.setDbOwner(dbOwner);
            return this;
        }

        public String dataSourceName() {
            return targetEntity.getDataSourceName();
        }

        public Builder dataSourceName(String dataSourceName) {
            targetEntity.setDataSourceName(dataSourceName);
            return this;
        }

        public IShardingable shardingable() {
            return targetEntity.getShardingable();
        }

        public Builder shardingable(IShardingable shardingable) {
            targetEntity.setShardingable(shardingable);
            return this;
        }


        public java.lang.String id() {
            return targetEntity.getId();
        }

        public Builder id(java.lang.String id) {
            targetEntity.setId(id);
            return this;
        }

        public java.lang.String resourceId() {
            return targetEntity.getResourceId();
        }

        public Builder resourceId(java.lang.String resourceId) {
            targetEntity.setResourceId(resourceId);
            return this;
        }

        public java.lang.String client() {
            return targetEntity.getClient();
        }

        public Builder client(java.lang.String client) {
            targetEntity.setClient(client);
            return this;
        }

        public java.lang.Integer type() {
            return targetEntity.getType();
        }

        public Builder type(java.lang.Integer type) {
            targetEntity.setType(type);
            return this;
        }

        public java.lang.String parentId() {
            return targetEntity.getParentId();
        }

        public Builder parentId(java.lang.String parentId) {
            targetEntity.setParentId(parentId);
            return this;
        }

        public java.lang.String name() {
            return targetEntity.getName();
        }

        public Builder name(java.lang.String name) {
            targetEntity.setName(name);
            return this;
        }

        public java.lang.String icon() {
            return targetEntity.getIcon();
        }

        public Builder icon(java.lang.String icon) {
            targetEntity.setIcon(icon);
            return this;
        }

        public java.lang.String path() {
            return targetEntity.getPath();
        }

        public Builder path(java.lang.String path) {
            targetEntity.setPath(path);
            return this;
        }

        public java.lang.String url() {
            return targetEntity.getUrl();
        }

        public Builder url(java.lang.String url) {
            targetEntity.setUrl(url);
            return this;
        }

        public java.lang.Integer sort() {
            return targetEntity.getSort();
        }

        public Builder sort(java.lang.Integer sort) {
            targetEntity.setSort(sort);
            return this;
        }

        public java.lang.Integer hideStatus() {
            return targetEntity.getHideStatus();
        }

        public Builder hideStatus(java.lang.Integer hideStatus) {
            targetEntity.setHideStatus(hideStatus);
            return this;
        }
    }

    public interface FIELDS {
        String ID = "id";
        String RESOURCE_ID = "resource_id";
        String CLIENT = "client";
        String TYPE = "type";
        String PARENT_ID = "parent_id";
        String NAME = "name";
        String ICON = "icon";
        String PATH = "path";
        String URL = "url";
        String SORT = "sort";
        String HIDE_STATUS = "hide_status";
    }

    public static final String TABLE_NAME = "security_menu";

    public static FieldConditionBuilder conditionBuilder() {
        return new FieldConditionBuilder();
    }

    public static FieldConditionBuilder conditionBuilder(String prefix) {
        return new FieldConditionBuilder(prefix);
    }

    public static FieldConditionBuilder conditionBuilder(Query<?> query) {
        return conditionBuilder(query, null);
    }

    public static FieldConditionBuilder conditionBuilder(Query<?> query, String prefix) {
        return new FieldConditionBuilder(query.owner(), query.dataSourceName(), prefix);
    }

    public static FieldConditionBuilder conditionBuilder(SecurityMenu entity) {
        return conditionBuilder(entity, null);
    }

    public static FieldConditionBuilder conditionBuilder(SecurityMenu entity, String prefix) {
        return new FieldConditionBuilder(entity.doGetSafeOwner(), entity.getDataSourceName(), prefix);
    }

    public static FieldConditionBuilder conditionBuilder(IDatabase owner, String prefix) {
        return new FieldConditionBuilder(owner, prefix);
    }

    public static FieldConditionBuilder conditionBuilder(IDatabase owner, String dataSourceName, String prefix) {
        return new FieldConditionBuilder(owner, dataSourceName, prefix);
    }

    public static class FieldConditionBuilder extends AbstractFieldConditionBuilder {

        public FieldConditionBuilder() {
            super(null, null, null);
        }

        public FieldConditionBuilder(String prefix) {
            super(null, null, prefix);
        }

        public FieldConditionBuilder(Query<?> query) {
            super(query.owner(), null, null);
        }

        public FieldConditionBuilder(Query<?> query, String prefix) {
            super(query.owner(), query.dataSourceName(), prefix);
        }

        public FieldConditionBuilder(IDatabase owner) {
            super(owner, null, null);
        }

        public FieldConditionBuilder(IDatabase owner, String prefix) {
            super(owner, null, prefix);
        }

        public FieldConditionBuilder(IDatabase owner, String dataSourceName, String prefix) {
            super(owner, dataSourceName, prefix);
        }

        public FieldCondition id() {
            return createFieldCondition(SecurityMenu.FIELDS.ID);
        }

        public FieldCondition resourceId() {
            return createFieldCondition(SecurityMenu.FIELDS.RESOURCE_ID);
        }

        public FieldCondition client() {
            return createFieldCondition(SecurityMenu.FIELDS.CLIENT);
        }

        public FieldCondition type() {
            return createFieldCondition(SecurityMenu.FIELDS.TYPE);
        }

        public FieldCondition parentId() {
            return createFieldCondition(SecurityMenu.FIELDS.PARENT_ID);
        }

        public FieldCondition name() {
            return createFieldCondition(SecurityMenu.FIELDS.NAME);
        }

        public FieldCondition icon() {
            return createFieldCondition(SecurityMenu.FIELDS.ICON);
        }

        public FieldCondition path() {
            return createFieldCondition(SecurityMenu.FIELDS.PATH);
        }

        public FieldCondition url() {
            return createFieldCondition(SecurityMenu.FIELDS.URL);
        }

        public FieldCondition sort() {
            return createFieldCondition(SecurityMenu.FIELDS.SORT);
        }

        public FieldCondition hideStatus() {
            return createFieldCondition(SecurityMenu.FIELDS.HIDE_STATUS);
        }
    }
}
